A virtual switch is an important part of a virtualized datacenter. The virtual switch provides network connectivity among virtual machines as well between the virtual machines and one or more external networks. When a virtual switch is created in a virtualized computing system, one of the configuration parameters defined at creation time is the maximum number of ports to be allocated to the virtual switch. This parameter is a static value and limits the number of virtual machine network interfaces that can be connected to the virtual switch at any one time. Once the limit is reached, the maximum number of ports parameter must be changed, which usually entails manual intervention by an end user. This limitation stands in the way of implementing a fully automated virtualized datacenter.
A number of issues arise in connection with virtual switches that are configured with a static maximum number of ports. First, when creating a virtual switch, an administrator needs to know ahead of time the number of virtual machines that may connect to the virtual switch. Further, virtual machine load-balancing solutions may be prevented from migrating virtual machines from an overburdened host to another host with under-utilized CPU and storage resources when virtual switches on the target host have all available ports allocated. In addition, ports that have been allocated to a virtual switch remain allocated to the virtual switch until an administrator manually deallocates them. Thus, without manual intervention, ports allocated to one virtual switch are unavailable for allocation to another (possibly busier) virtual switch. Finally, with a static maximum number of ports for a virtual switch, an administrator needs to continually monitor the number of ports allocated for each virtual switch defined on a host and, when necessary, redefine the maximum number of ports so that connections to a virtual switch are not refused.
One naïve solution to the above-described problem would be to allocate to each virtual switch a very large number of ports such that a port is likely to be available for any virtual machine that requires one. However, data structures that are allocated for virtual switch ports consume host memory. Thus, maintaining a large number of potentially inactive ports is likely to be wasteful. Another potential solution may be to configure a single large virtual switch that would service all virtual machines requiring network connectivity. This solution suffers from the same drawbacks as overallocating ports to separate virtual switches (i.e., the wasting of host memory). Further, defining a single switch with a large number of ports eliminates the ability to maintain different configurations for different virtual switches and makes isolating network traffic for different sets of virtual machines more difficult. In addition, a single virtual switch would prevent different types of virtual switches from coexisting on the same host. For example a VMware virtual switch and a Cisco virtual switch could not coexist on the same host.